package com.comp490.sprite;

import android.graphics.Bitmap;
import android.graphics.Canvas;

import com.comp490.shooter.GameView;

public abstract class Sprite implements Collidable
{
    protected int bmpWidth;
    protected int bmpHeight;
    protected int screenWidth;
    protected int screenHeight;
    protected float x;
    protected float y;
    protected float centerBitmapX;
    protected float centerBitmapY;
    protected boolean explode = false; 
    protected boolean active;
    protected Bitmap bitmap;
    protected GameView gameView;

    public Sprite(GameView gameView)
    {
        this.gameView = gameView;
        screenWidth = gameView.getWidth();
        screenHeight = gameView.getHeight();
        x = -100;
        y = -100;
        active = false;
    }

    public abstract void draw(Canvas canvas);

    public Bitmap getBitmap()
    {
        return bitmap;
    }

    public void setBitmap(Bitmap bitmap, int bitmapWidth, int bitmapHeight)
    {
        this.bitmap = bitmap;
        bmpWidth = bitmap.getWidth();
        bmpHeight = bitmap.getHeight();
        centerBitmapX = bitmapWidth / 2;
        centerBitmapY = bitmapHeight / 2;
    }

    public float getX()
    {
        return x;
    }

    public void setX(float x)
    {    		
        this.x = x;
    }

    public float getY()
    {
        return y;
    }

    public void setY(float y)
    {
        this.y = y;
    }

    public int getMax_X()
    {
        return screenWidth - bmpWidth;
    }

    public int getMax_Y()
    {
        return screenHeight - bmpHeight;
    }

    public boolean isExploding()
    {
        return explode;
    }
    
    public boolean isActive()
	{
		return active;
	}

	public void setActive(boolean active)
	{
		this.active = active;
	}

    public abstract float getCenterBitmapX();

    public abstract float getCenterBitmapY();
}